package com.longcai.piaojia.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

import com.longcai.piaojia.R;
import com.longcai.piaojia.conn.SignRecordGet;
import com.zcx.helper.bound.BoundView;
import com.zcx.helper.bound.BoundViewHelper;
import com.zcx.helper.scale.ScaleScreenHelperFactory;

import java.util.List;

/**
 * Created by Administrator on 2016/11/10.
 */
public class SignRecordAdapter extends ArrayAdapter<SignRecordGet.SingRecord> {

    private Context context;
    private LayoutInflater layoutInflater;

    public SignRecordAdapter(Context context, List<SignRecordGet.SingRecord> lists) {
        super(context, 0, lists);

        this.context = context;

        layoutInflater = LayoutInflater.from(context);

    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {

        ViewHolder viewHolder;

        SignRecordGet.SingRecord singRecord = getItem(position);

        if (convertView == null) {

            convertView = BoundViewHelper.boundView(viewHolder = new ViewHolder(), ScaleScreenHelperFactory.getInstance().loadView((ViewGroup) layoutInflater.inflate(R.layout.item_sign_record_list, null)));

            convertView.setTag(viewHolder);

        } else {

            viewHolder = (ViewHolder) convertView.getTag();

        }


        viewHolder.item_sign_record_time_tv.setText(singRecord.times);
        viewHolder.item_sign_record_content_tv.setText(singRecord.info);


        return convertView;
    }

    class ViewHolder {

        @BoundView(R.id.item_sign_record_time_tv) private TextView item_sign_record_time_tv;
        @BoundView(R.id.item_sign_record_content_tv) private TextView item_sign_record_content_tv;

    }




}
